﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace Select_command
{
    class Program
    {
       static void Main(string[] args)
      {
            SqlConnection conn = new SqlConnection("Data Source=(local);Initial Catalog=sale; User Id=sa; Password=sa");
            SqlDataReader dr = null;
            conn.Open();
            SqlCommand cmd = new SqlCommand("select * from Customers", conn);
            dr = cmd.ExecuteReader();
            while (dr.Read() == true)
            {
                Console.WriteLine("ID: {0} - Name: {1}", dr[0], dr[1]);
            }
            dr.Close();
            conn.Close();
    }
  }
}
